package com.epwk.element;

import com.epwk.logger.LoggerControler;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.util.List;

import static com.epwk.driver.SeleniumDriver.driver;

/**
 * Created by Administrator on 2016/11/21.
 */
public class WebEles {
    final static LoggerControler log= LoggerControler.getLogger(WebEles.class);


    public static List<WebElement> findElements(final By by){

        List<WebElement> webElements = null;

//        WebElement WebElement;
//        WebElements = new WebDriverWait(driver,10).until(ExpectedConditions.presenceOfElementLocated(by));
        try{
            WebDriverWait wait = new WebDriverWait(driver,10);
            wait.until(ExpectedConditions.presenceOfElementLocated(by));
        }catch (Exception e){
            log.error("元素没找到");
            e.printStackTrace();
        }
        return webElements;



    }
}
